﻿using NUnit.Framework;
using Pantry.DataAccess;
using Pantry.Entity;
using System;

namespace Pantry.UnitTest
{
    [TestFixture]
    class TestSupportingMaterialDao
    {
        private const string ConnectionString = "Server=10.16.102.126;Database=Pantry_MockProject;Integrated Security=True;";
        private readonly SupportingMaterialDao _supDao;

        public TestSupportingMaterialDao()
        {
            _supDao = new SupportingMaterialDao(ConnectionString);
        }

        [Test, Sequential]
        public void InsertSupportingMaterial()
        {
            var sup = new SupportingMaterial
                          {
                              Id = 1,
                              Url = "dasd",
                              Description = "dsad",
                              Type = "pdf",
                              AddedBy = "dasd",
                              AddedDate = DateTime.Parse("1/1/2011"),
                              UserName = "duongnt8",
                              OrgId = 1,
                              IsActive = true
                          };
            int result = _supDao.InsertSupportingMaterial(sup);
            const int expectedResult = 1; // insert successfully
            Assert.AreEqual(result, expectedResult, "Test Successfully");
        }
    }
}
